﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JulMar.Windows.Mvvm;
using MediaBrowser.Gui.MvvmUtils.UI;

namespace MediaBrowser.Gui.ViewModels
{
    public class SplashScreenMBViewModel : ViewModel
    {
        #region properties

        private String lBTitle;
        public String LBTitle
        {
            get
            {
                return lBTitle;
            }
            set
            {
                lBTitle = value;
                OnPropertyChanged("LBTitle");
            }
        }

        private String lBName;
        public String LBName
        {
            get
            {
                return lBName;
            }
            set
            {
                lBName = value;
                OnPropertyChanged("LBName");
            }
        }

        private String lBInfo;
        public String LBInfo
        {
            get
            {
                return lBInfo;
            }
            set
            {
                lBInfo = value;
                OnPropertyChanged("LBInfo");
            }
        }

        private String lBVersion;
        public String LBVersion
        {
            get
            {
                return lBVersion;
            }
            set
            {
                lBVersion = value;
                OnPropertyChanged("LBVersion");
            }
        }

        private Double valueProgress;
        public Double ValueProgress
        {
            get
            {
                return valueProgress;
            }
            set
            {
                valueProgress = value;
                OnPropertyChanged("ValueProgress");
                ISplashScreenService splashScreenService = Resolve<ISplashScreenService>();
                if (splashScreenService != null)
                {
                    splashScreenService.Refresh();
                }
            }
        }

        #endregion

        public SplashScreenMBViewModel()
        {
            LBTitle = "Media Browser";
            LBName = "Media Browser";
            LBInfo = "Chargement ...";
            LBVersion = "Version : " + System.Windows.Forms.Application.ProductVersion;
        }

        public void ReportProgress(int percentProgress, object userState)
        {
            LBInfo = userState.ToString();
            ValueProgress = percentProgress;
        }
    }
}
